/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

body {
  background-color: #f5f5f5;
  padding: 20px 0;
}

/* 容器：居中控制宽度 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 标题样式 */
.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  color: #333;
  font-size: 28px;
}

/* 功能模块外层样式 */
.form-section, .stats-section, .records-section {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 25px;
}

section h2 {
  color: #333;
  font-size: 20px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

/* 表单样式 */
.form-group {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.form-group label {
  flex: 0 0 120px;
  color: #666;
  font-size: 14px;
  margin-right: 10px;
}

.form-group select, .form-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}

.submit-btn {
  background-color: #4285f4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-left: 130px;
}

.submit-btn:hover {
  background-color: #3367d6;
}

/* 统计卡片样式 */
.stats-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.stat-card {
  flex: 1;
  min-width: 200px;
  background-color: #fafafa;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
  color: #666;
  font-size: 16px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
}

/* 颜色区分：收入绿、支出红 */
.income { color: #34a853; }
.expense { color: #ea4335; }

/* 支出分类占比（进度条） */
.category-stats { padding: 10px 0; }

.category-progress { margin-bottom: 15px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 14px;
  color: #666;
}

.progress-bar {
  height: 10px;
  background-color: #eee;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s;
}

/* 分类颜色 */
.category-food .progress-fill { background-color: #ff6b6b; }
.category-transport .progress-fill { background-color: #4ecdc4; }
.category-shopping .progress-fill { background-color: #ffd166; }
.category-entertainment .progress-fill { background-color: #6a0572; }
.category-other-expense .progress-fill { background-color: #95a5a6; }

.empty-tip {
  color: #999;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* 记录表格样式 */
.records-table-container { overflow-x: auto; }

#recordsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#recordsTable th, #recordsTable td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

#recordsTable th {
  background-color: #fafafa;
  color: #666;
  font-weight: 600;
}

#recordsTable tbody tr:hover {
  background-color: #f9f9f9;
  cursor: default;
}

/* 表格内类型颜色 */
.record-type-income { color: #34a853; font-weight: 500; }
.record-type-expense { color: #ea4335; font-weight: 500; }

/* 删除按钮 */
.delete-btn {
  background-color: #ea4335;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.delete-btn:hover { background-color: #d33526; }

.empty-records {
  color: #999;
  text-align: center;
  padding: 30px 0;
}

/* 响应式适配（手机屏幕） */
@media (max-width: 768px) {
  .form-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-group label {
    flex: none;
    margin-bottom: 5px;
  }

  .form-group select, .form-group input {
    width: 100%;
    min-width: auto;
  }

  .submit-btn {
    margin-left: 0;
    width: 100%;
    margin-top: 10px;
  }

  .stats-cards { flex-direction: column; }
}